package com.hbnu.sync.domain.base;



/**
 * 枚举了一些常用API操作码
 */
public enum ResultCode implements IErrorCode {
    SUCCESS(200, "处理成功"),
    FAILED(501, "处理失败"),
    SERVER_ERROR(500, "服务器内部错误"),
    VALIDATE_FAILED(402, "参数检验失败"),
    UNAUTHORIZED(401, "暂未登录或token已经过期"),
    NOT_FOUND(404, "服务未找到"),
    /**
     * 业务异常
     */
    FAILURE(400, "业务异常"),
    REPEAT_ERROR(-1, "已有重复数据"),
    DATE_FORMAT_ERROR(-2, "时间格式错误"),
    DB_ERROR(-3, "DB操作失败"),
    NOT_FOUND_DATA(-4, "没有找到数据"),
    FOUND_MORE_DATA(-5, "找到多条数据"),
    FOUND_ERROR(12, "操作失败"),
    FORBIDDEN(403, "没有相关权限");

    private final int code;
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
